package game;

/**
 * Time Attack Mode - has limit time and score is round.
 * @author Natchanon Hongladaromp
 *
 */
public class TimeAttackMode implements GameMode
{
	private Game game;
	private double limitTime;
	
	/**
	 * Construct for this mode.
	 * @param game
	 * @param limitTime
	 */
	public TimeAttackMode(Game game,double limitTime)
	{
		this.game = game;
		this.limitTime = limitTime;
	}
	
	@Override
	public double getScore()
	{
		return game.getRound() + 1;
	}
	
	@Override
	public String toString()
	{
		return "Time Attack Mode";
	}

	@Override
	public void newTask()
	{
		game.newTask();
	}

	@Override
	public void updateTime()
	{
		if(game.getTime() >= limitTime && !game.isFinish())
			game.end();
	}
}
